﻿@model PagedList.IPagedList<SoftHotel.Models.Cliente>

@{
    ViewBag.Title = "Clientes";
}

<h2>Clientes</h2>

<fieldset>
<legend>Búsqueda de Clientes</legend>

<p>
    @Html.ActionLink("Nuevo", "Create")
</p>


@using (Html.BeginForm())
{
    <p>
        Buscar por nombre: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string)  
        <input type="submit" value="Buscar" /></p>
}


<table rules="all" style="border-color: #bgbgbg; width: 900px; margin-bottom: 0px;" border="1">
    <tr>    
        <th style="font-weight: bold; width: 50px;" align="center">
            Número de Documento
        </th>
        <th style="font-weight: bold; width: 300px;" align="center">
            @Html.ActionLink("Razon Social", "Buscar", new { sortOrder = ViewBag.NombreSort, currentFilter = ViewBag.CurrentFilter })
        </th>
          
        <th style="font-weight: bold; width: 200px;" align="center">
            Correo Electrónico
        </th>
        <th style="font-weight: bold; width: 100px;" align="center">
            Tipo de Documento
        </th>
        <th style="font-weight: bold; width: 100px;" align="center">
            Tipo Cliente
        </th>
        <th style="font-weight: bold; width: 50px;" align="center"></th>
       @* <th>
            productos
        </th> *@
        
    </tr>
    @foreach (var genre in Model)
    {
              
    <tr style="color:@(genre.apellidoPaterno == "carlos" ? "red" : "black")">     
            
        <td align="center"> 
           @Html.ActionLink(@genre.numDoc, "Edit", genre)
        </td>
        <td align="center"> 
            @genre.razonsocial @genre.nombres @genre.apellidoPaterno @genre.apellidoMaterno
        </td>
        
        <td align="center"> 
            @genre.email
        </td>
        <td align="center"> 
            @genre.objeTipoDoc.valor
        </td>
        <td align="center"> 
            @genre.objTipoCliente.valor
        </td>
        <td style="font-weight: bold; width: 50px;" align="center"><a href = "/Clientes/Edit?idCliente=@genre.idCliente"><img border="0" src="@Href("~/Content/Images/edit.jpg")"></a><a href = "/Clientes/Eliminar?@Model"><img border="0" src="@Href("~/Content/Images/delete.jpg")"></a></td>
    </tr>
}     

<br />
<div>
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    of @Model.PageCount
     
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "Buscar", new { page = 1})
        @Html.Raw(" ");
        @Html.ActionLink("< Prev", "Buscar", new { page = Model.PageNumber - 1})
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Prev
    }
     
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Next >", "Buscar", new { page = Model.PageNumber + 1})
        @Html.Raw(" ");
        @Html.ActionLink(">>", "Buscar ", new { page = Model.PageCount})
    }
    else
    {
        @:Next >
        @Html.Raw(" ")
        @:>>
    }
    <br />
</div>
<br />
</table>

